<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			function fun(){
				window.location.href = "https://www.baidu.com";
			}
			function fun2(){
				alert(window.location.href)
			}
		</script>
	</head>
	<body>
		<a href="javascript:void()" onclick="fun()">请点击这里跳转到百度</a>
		<button onclick="fun2()">获取当前URL</button>
	</body>
</html>
